package com.pingbu.tijian.hospital.backapi.api;

import com.github.pagehelper.PageInfo;
import com.pingbu.common.bean.ResultBean;
import com.pingbu.tijian.hospital.backapi.bean.entity.EnglishWord;
import com.pingbu.tijian.hospital.backapi.bean.entity.Student;
import com.pingbu.tijian.hospital.backapi.service.EnglishWordService;
import com.pingbu.tijian.hospital.backapi.service.UserInfoService;
import com.pingbu.tijian.hospital.backapi.service.UserPermissionService;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/english_word")
public class EnglishWordController {

    private static Logger logger = LoggerFactory.getLogger(EnglishWordController.class);

    @Autowired
    private EnglishWordService englishWordService;

    @PostMapping(value = "/page")
    public ResultBean<PageInfo<EnglishWord>> page(@RequestBody EnglishWord param) {
        ResultBean<PageInfo<EnglishWord>> rb1 = englishWordService.page(param);
        return rb1;
    }

    @PostMapping(value = "/save")
    public ResultBean<Integer> save(@RequestBody EnglishWord param) {
        if (param.getNoid() == null) {
            ResultBean<Integer> rb2 = englishWordService.add(param);
            return rb2;
        }
        ResultBean<Integer> rb = englishWordService.update(param);
        return rb;
    }

    @PostMapping(value = "/delete")
    public ResultBean<Integer> delete(@RequestBody EnglishWord param) {
        ResultBean<Integer> rb = englishWordService.delete(param);
        return rb;
    }
}
